package edu.ou.herbarium.threads;

public class ShareData2 {
	private TransferData spec;
	private boolean writeable = true;

	public synchronized void setShareChar(TransferData c) {
		if (!writeable) {
			try {
				wait();
			} catch (InterruptedException e) {
			}
		}

		this.spec = c;
		writeable = false;
		notify();
	}

	public synchronized TransferData getShareChar() {
		if (writeable) {
			try {
				wait();
			} catch (InterruptedException e) {
			}
		}
		writeable = true;
		notify();
		return this.spec;
	}

}
